package main

import (
	"game_go/config"
	_ "game_go/routers"

	"game_go/dao"
	"game_go/uptask"
	"log"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/toolbox"
)

func main() {
	defer dao.Database.Close()

	go func() {
		defer toolbox.StopTask()
		if config.TConfig != nil {
			for index, value := range config.TConfig {
				uptask.UpdateGameTask(index, value.Name, value.Time)
			}
		}

		toolbox.StartTask()
		log.Println("start task")
		select {}
	}()
	beego.Run()
}
